#include <iostream>
#include <bits/ostream.tcc>
//
// Created by Asus on 2025/6/1.
//
using namespace std;

class Base {
public:
    //纯虚函数
    //类中只要有一个纯虚函数就称为抽象类
    //抽象类无法实例化对象
    //子类必须重写父类中的纯虚函数，否则也属于抽象类
    virtual void func() = 0;
};

class Son : public Base {
    public:
    virtual void func() {
        cout << "Son:func()" << endl;
    };
};

void demo01() {
    Base *base = NULL;
    // base = new Base 抽象类无法实例化对象
    base= new Son;
    base->func();
    delete base;
}

int main(int argc, char *argv[]) {
    demo01();
    return 0;
}
